package com.remenote.remenoteback.dao;

import com.remenote.remenoteback.entity.doo.NoteDo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface NoteRepository  extends JpaRepository<NoteDo,Integer> {
    NoteDo findNoteDoByIdAndUsername(int id, String username);

    NoteDo findById(int id);
//    查询没有被删除的某个笔记
    NoteDo findNoteDoByNotebookAndNoteTitleAndUsernameAndIsDelete(String notebook, String title, String username,boolean isDelete);
//    查询某个笔记本中的所有笔记
    List<NoteDo> findNoteDosByNotebookIdAndUsernameAndIsDelete(Integer notebookId, String username,boolean isDelete);
//    查询标题包含关键词的笔记
    List<NoteDo> findNoteDoByNoteTitleContainingAndUsernameAndIsDelete(String key, String username,boolean isDelete);
//    查询所有未删除的笔记
    List<NoteDo> findNoteDoByUsernameAndIsDelete(String username,boolean isDelete);
//    公开的笔记
    List<NoteDo> findNoteDoByUsernameAndIsPublicAndIsDelete(String username,boolean isPublic,boolean isDelete);
//    查询某个用户公开的笔记
    List<NoteDo> findNoteDoByIsPublicAndUsernameAndIsDelete (boolean isPublic,String username,boolean isDelete);
}
